class OrgantypesController < ApplicationController
  # GET /tipoorgaos
  # GET /tipoorgaos.xml
  def index
    @organtypes = Organtype.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @organtypes }
    end
  end

  # GET /tipoorgaos/1
  # GET /tipoorgaos/1.xml
  def show
    @organtype = Organtype.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @organtype }
    end
  end

  # GET /tipoorgaos/new
  # GET /tipoorgaos/new.xml
  def new
    @organtype = Organtype.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @organtype }
    end
  end

  # GET /tipoorgaos/1/edit
  def edit
    @organtype = Organtype.find(params[:id])
  end

  # POST /tipoorgaos
  # POST /tipoorgaos.xml
  def create
    @organtype = Organtype.new(params[:organtype])

    @organtype = modifica @organtype,params[:organtype]

    respond_to do |format|
      if @organtype.save
        flash[:notice] = 'Tipoorgao was successfully created.'
        format.html { redirect_to(organtypes_url) }
        format.xml  { render :xml => @organtype, :status => :created, :location => @organtype }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @organtype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /tipoorgaos/1
  # PUT /tipoorgaos/1.xml
  def update
    @organtype = Organtype.find(params[:id])

    respond_to do |format|
      if @organtype.update_attributes(params[:organtype])
        flash[:notice] = 'Tipoorgao was successfully updated.'
        format.html { redirect_to(organtypes_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @organtype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /tipoorgaos/1
  # DELETE /tipoorgaos/1.xml
  def destroy
    @organtype = Organtype.find(params[:id])
    @organtype.destroy

    respond_to do |format|
      format.html { redirect_to(organtypes_url) }
      format.xml  { head :ok }
    end
  end
end
